package com.henry.c05.autoconfig;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;

@Configuration
@Import(SchoolMaster.class)
@EnableConfigurationProperties(DefaultStudent.class)

public class DefaultSchool {

    @Autowired
    SchoolMaster schoolMaster;

    @Autowired
    DefaultStudent defaultStudent;

    @Bean
    public DefaultClass getKlass(){
        return new DefaultClass(defaultStudent.getName()+"'s class in "+schoolMaster.name+"'s school");
    }
}
